package battleship;

import java.util.ArrayList;
import java.util.concurrent.LinkedBlockingQueue;

public class Game {
    
    public int player1ID;
    public int player2ID;
    
//    User player1;
//    User player2;
    String startingPlayer;
//    LinkedBlockingQueue<User> waitForOpponent; // wait for someone to join this game
//    ArrayList<ArrayList<int[]>> player1Ships;
//    ArrayList<ArrayList<int[]>> player2Ships;
//    boolean player1DonePlacingShips = false;
//    boolean player2DonePlacingShips = false;
//    LinkedBlockingQueue<User> opponentFinished = new LinkedBlockingQueue<User>(); // wait for opponent to finish placing their ships
//    LinkedBlockingQueue<int[]> shotMadeByPlayer1 = new LinkedBlockingQueue<int[]>(); // wait for opponent to make their shot
//    LinkedBlockingQueue<int[]> shotMadeByPlayer2 = new LinkedBlockingQueue<int[]>(); // wait for opponent to make their shot
//    ArrayList<int[]> player1Hit = new ArrayList<int[]>(); // coordinates where player1 has been hit
//    ArrayList<int[]> player2Hit = new ArrayList<int[]>();
    LinkedBlockingQueue<User> gameOverQueue = new LinkedBlockingQueue<User>();  // the winner gets put inside when the game ends

    public Game() {
//        System.out.println("Game: a game was created");
        generateStartingPlayer();
//        waitForOpponent = new LinkedBlockingQueue<User>();
    }

//    public User getPlayer1() {
//        return player1;
//    }
//
//    public void setPlayer1(User player1) {
//        this.player1 = player1;
//    }
//
//    public User getPlayer2() {
//        return player2;
//    }
//
//    public void setPlayer2(User player2) {
//        this.player2 = player2;
//    }

    public String getStartingPlayer() {
        return startingPlayer;
    }

    private void generateStartingPlayer() {
        double random = Math.random();
        if (random < 0.5) {
            startingPlayer = "player1";
        } else {
            startingPlayer = "player2";
        }
    }
    
}
